/*
 * @(#)IUserDAO.java		       Project:SpikeSC
 * Date:2012-7-24
 *
 * Copyright (c) 2011 CFuture09, Institute of Software, 
 * Guangdong Ocean University, Zhanjiang, GuangDong, China.
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.sinaapp.msdxblog.spikesc.dao;

import java.sql.SQLException;

import com.sinaapp.msdxblog.spikesc.vo.SpikeUser;

/**
 * @author Geek_Soledad (66704238@51uc.com)
 */
public interface IUserDAO {

	/**
	 * 用户密码验证
	 * 
	 * @param name
	 *            账号
	 * @param password
	 *            密码
	 * @return 是否存在此账号及密码的用户，是则返回true，否则返回false。
	 * @throws SQLException
	 */
	public SpikeUser findUser(String name, String password) throws SQLException;

	/**
	 * 添加用户。
	 * 
	 * @param name
	 *            账号
	 * @param password
	 *            密码
	 * @param roleId
	 *            角色ID。
	 * @return 添加成功时返回true，否则返回false。
	 * @throws SQLException 
	 */
	public boolean saveUser(String name, String password, int roleId) throws SQLException;

	/**
	 * 修改密码
	 * 
	 * @param name
	 *            账号名
	 * @param password
	 *            密码
	 * @return 当修改成功时返回true，否则返回false。
	 */
	public boolean updateUser(String name, String password);

	/**
	 * 删除用户。
	 * 
	 * @param name
	 *            将被删除的用户名。
	 * @return 当删除成功时返回true, 否则返回false。
	 */
	public boolean removeUser(String name);

	/**
	 * 返回用户总数。
	 * 
	 * @return 用户总数。
	 * @throws SQLException
	 */
	public int findUserCount() throws SQLException;
}
